package cn.itsource.config;

import cn.itsource.itsource.config.LoginCheckInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MvcConfig  implements WebMvcConfigurer {

    @Autowired
    private LoginCheckInterceptor loginCheckInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //将自定义的拦截器，添加到Springmvc的配置中，这样就可以生效  "/user/login",
        registry.addInterceptor(loginCheckInterceptor).addPathPatterns("/**")
                .excludePathPatterns(
                        "/user/login","/file/upload","/shop/register",
                "/user/sendmobilecode/**","/user/checkphone/**","/user","/wechart/**","/pay-demo.html"
                        ,"/orderadopt/notifyUrl/**"//这里一定要方形支付宝回调的url地址  理由:回调地址中是不会携带token令牌的

                );

    }
}